

#ifndef UD_DBSPINDX_H
#define UD_DBSPINDX_H

#include "zdbindex.h"

#pragma pack (push, 8)

class UcDbSpatialIndex: public UcDbIndex
{
public:
    UCDB_DECLARE_MEMBERS(UcDbSpatialIndex);
	     UcDbSpatialIndex();
    virtual ~UcDbSpatialIndex();

    virtual UcDbFilteredBlockIterator* newIterator(const UcDbFilter* pFilter)
                                                   const;

    virtual Ucad::ErrorStatus rebuildFull(UcDbIndexUpdateData* pIdxData);

protected:
    virtual Ucad::ErrorStatus rebuildModified(UcDbBlockChangeIterator* iter);
};

class UcDbImpSpatialIndexIterator;
class UcDbSpatialFilter;

class UcDbSpatialIndexIterator : public UcDbFilteredBlockIterator
{
public:
	UcDbSpatialIndexIterator(const UcDbSpatialIndex*  pIndex,
                                 const UcDbSpatialFilter* pFilter);
        virtual ~UcDbSpatialIndexIterator();

	virtual Ucad::ErrorStatus start();
	virtual UcDbObjectId      next();
	virtual UcDbObjectId      id() const;
	virtual Ucad::ErrorStatus seek(UcDbObjectId id);

        virtual double estimatedHitFraction() const;
        virtual Ucad::ErrorStatus accepts(UcDbObjectId id,
                                    ZSoft::Boolean& stat) const;

private:
        UcDbImpSpatialIndexIterator* mpImpIter;
};

#pragma pack (pop)

#endif 
